package com.quantgroup.data.saastest.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.quantgroup.data.saastest.bean.Cost;
import com.quantgroup.data.saastest.mapper.CostMapper;
import com.quantgroup.data.saastest.service.CostService;
import com.quantgroup.saas.dynamicdatasources.SaasParameter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author yangjinhua
 */
@Slf4j
@Service
public class CostServiceImpl extends ServiceImpl<CostMapper, Cost> implements CostService {

	@Override
	public void insert(Cost cost)  {
		log.warn("---"+ JSON.toJSONString(SaasParameter.getTenant()));
		System.out.println("insert:" + baseMapper.insert(cost));
	}

	@Override
//	@DynamicRoutingDataSource("dataSource1")
	public void insert2(Cost cost)  {
		System.out.println("insert2:" + baseMapper.insert(cost));
	}

	@Override
	public Cost getById(int id) {
		return baseMapper.selectByPrimaryKey(id);
	}





}